#include <REGX52.H>

unsigned int M = 0;

void TimerSet()
{
	TMOD = 0x01;
	TH0 = (65536 - 9174) / 256;
	TL0 = (65536 - 9174) % 256;
	TR0 = 1;
}

void Timer(unsigned int X)
{
	TimerSet();

	while (M < X)
	{
		while (TF0 == 0);
		TH0 = (65536 - 9174) / 256;
		TL0 = (65536 - 9174) % 256;
		M++;
		TF0 = 0;
	}
	M = 0;

}